#!/bin/zsh

printf "\e[33;1m%s\e[0m\n" '---Running git hook Pre-Push---'

 if [[ `git status --porcelain` ]]; then
   printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.'
   exit 0
 fi

printf "\e[33;1m%s\e[0m\n" '>>>Running the Flutter analyzer' ""
flutter analyze
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
  printf "\e[31;1m%s\e[0m\n" '!!!Flutter analyzer error'
  exit 0
fi
printf "\e[33;1m%s\e[0m\n" '<<<Finished running the Flutter analyzer' ""
